﻿//////////////////////////////////////////////////////////////////////////
// FileName:fmCarInsuranceManager.aspx
// CreateBy:DragonXiong
// CreateDate:2010-05-25
// Description:
//		Car Insurance Manager
//      
// Modify Log:
//	
// Copyright:
/////////////////////////////////////////////////////////////////////////
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Auto.Web.Common;
using Auto.Components;
using Model = Auto.Data.BusMan.Model;
using BLL = Auto.Data.BusMan.BLL;

namespace Auto.BusMan
{
    public partial class fmCarInsuranceManager : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPage();
            }
        }

        private void InitPage()
        {
            BindData();
        }

        private void ClearText()
        {

        }

        private Model.BusInsurance GetCarInsurance()
        {
            //Tab1
            string BusID = this.txtBusIdentificationNO.Text;// this.txtBusID.Text;
            string InsuranceCompany = this.txtInsuranceCompany.Text;
            string InsuranceFormCopy = this.ucInsuranceFormCopyFileManager.FileList; //this.txtInsuranceFormCopy.Text;
            DateTime InsuranceDate = DateTime.Parse(this.txtInsuranceDate.Text);
            int InsuranceCycle = int.Parse(this.txtInsuranceCycle.Text);
            //string Note = this.txtNote.Text;


            Model.BusInsurance model = new Model.BusInsurance();
            //Tab1
            model.BusID = BusID;
            model.InsuranceCompany = InsuranceCompany;
            model.InsuranceFormCopy = InsuranceFormCopy;
            model.InsuranceDate = InsuranceDate;
            model.InsuranceCycle = InsuranceCycle;
            //model.Note = Note;

            return model;
        }

        #region --BindData--
        protected void BindData()
        {

        }

        #endregion --BindData--

        #region Event

        protected void obtnSave_Click(object sender, EventArgs e)
        {
            BLL.BusInsurance bll = new BLL.BusInsurance();
            try
            {
                bll.Add(GetCarInsurance());
                BindData();
            }
            catch (Exception ex)
            {
                Jscript.AjaxAlert(this, ex.Message);
            }
        }

        #endregion Event
    }
}